home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Sapphire Collection / Software Vault (Sapphire Collection) (Digital Impact).ISO / cdr14 / apmtst.zip / OS2PRT.CMD < prev    next >
OS/2 REXX Batch file  |  1994-09-27  |  4KB  |  117 lines

  1. /****************** IBM Internal Use Only *************************/
  2. /* TRAPTRAP: Process a OS/2 System error box window               */
  3. /*           ---- Sample program demonstrating APMT -----         */
  4. /* Author: Dev Banerjee (IBM Corporation)                         */
  5. /*                                                                */
  6. /* (C) Copyright IBM Corporation 1994. All rights reserved.       */
  7. /*  All rights reserved                                           */
  8. /*                                                                */
  9. /* Function:                                                      */
  10. /* This command will print the contents of the topmost window on  */
  11. /* the desktop, IF THAT WINDOW IS A STANDARD OS/2 COMMAND WINDOW. */
  12. /* Normal print screen key prints the prints in graphics format   */
  13. /* and is slow.   This command will copy the contents to the      */
  14. /* clipboard and then to  temporary file, and then print it.      */
  15. /* To Install:                                                    */
  16. /*   - Install APMT                                               */
  17. /*   - From directory where this file, and OS2PRT.ICO exists,     */
  18. /*     ENTER 'OS2PRT INSTALL'                                     */
  19. /*   - This will create an icon, PrintScreen, on the dekstop.     */
  20. /* To Use:                                                        */
  21. /*   - Make the os/2 window you want to print, the top window     */
  22. /*   - double click on the icon                                   */
  23. /*                                                                */
  24. /* Prereqs:                                                       */
  25. /*                                                                */
  26. /*   APMT rexx function package (OS2EWS)                          */
  27. /******************************************************************/
  28. Trace off
  29. arg option
  30. if option = 'INSTALL' then do
  31.    call install
  32.    exit
  33.    end
  34. if option \= 'FROMICON' then do
  35.    call showhelp
  36.    exit
  37.    end
  38. /*---- invoked as expected */
  39. call APMT_INIT
  40. rc = SELECT_WINDOW("*")
  41.  
  42. rc = SET_FOCUS()   /* NOT NEEDED, but a nice touch */
  43.  
  44. rc = SYSMENU_SELECT("Copy All")
  45. if rc > 0 then do
  46.    say "This window does not have a 'Copy All' sysmenu item"
  47.    say "Not a standard OS/2 text window"
  48.    signal APMT_CLOSE
  49.    end
  50. if  QUERY_CLIPBOARD_TEXT("clip") = 0 then do
  51.    'del temp.prt'
  52.    do i = 1 to clip.0
  53.       trash = lineout("temp.prt",clip.i)
  54.       end
  55.    trash = lineout("temp.prt")
  56.    'print temp.prt'
  57.    'del temp.prt'
  58.    end
  59. /******************************************************************/
  60. APMT_CLOSE:
  61. rc = END_SESSION();
  62. exit
  63. /******************************************************************/
  64. errorexit:
  65. call DropFUNC
  66. exit
  67. LoadFUNC:
  68.  call rxfuncadd  'APMTLoadFuncs',  'apmtext', 'APMTLoadFuncs'  /* entry points from the DLL    */
  69.  call APMTLoadFuncs;
  70. return
  71.  
  72. DropFUNC:
  73.  call APMTDropFuncs;
  74.  call rxfuncdrop(APMTDropFuncs)
  75. return
  76.  
  77. APMT_INIT:
  78. signal on error name  errorexit
  79. call rxfuncadd  'APMTLoadFuncs',  'apmtext', 'APMTLoadFuncs'  /* entry points from the DLL    */
  80. call APMTLoadFuncs;
  81. rc = INIT_SESSION();
  82. if rc \= 0
  83.    then do
  84.      say apmtmsg
  85.      signal errorexit
  86.      end
  87. signal on halt name APMT_CLOSE
  88. return
  89.  
  90.  
  91. INSTALL:
  92. If RxFuncQuery('SysLoadFuncs') Then Do
  93.   Call RxFuncAdd 'SysLoadFuncs', 'REXXUTIL', 'SysLoadFuncs'
  94.   Call SysLoadFuncs
  95. End
  96.  
  97. Sysrc=SysCreateObject("WPProgram","PrintScreen","<WP_DESKTOP>",,
  98.   "ICONFILE=OS2PRT.ICO;"||,
  99.   "EXENAME=os2prt.cmd;"||,
  100.   "PARAMETERS=fromicon;"||,
  101.   "PROGTYPE=WINDOWABLEVIO;"||,
  102.   "MINIMIZED=YES;"||,
  103.   '', 'U');
  104. return
  105.  
  106. SHOWHELP:
  107. say 'This command will cause a os/2 text window to be printed '
  108. say ''
  109. say 'The proper way to run this command is : '
  110. say '  1. Make the os/2 text window you want to print, the active window'
  111. say '  2. Double Click on the PrintScreen icon on the desktop '
  112. say ''
  113. say 'To create the PrintScreen icon on the desktop, enter: '
  114. say '     OS2PRT INSTALL'
  115. return
  116.  
  117.